package com.player.thirdGroup.entity;

import com.fasterxml.jackson.annotation.JsonFormat;

import javax.persistence.*;
import java.util.Date;
import java.util.List;

/**
 * @author VULCAN
 * @create 2019-12-27 21:05
 * @desc 角色表
 **/
@Entity
@Table(name = "sys_role")
public class Role {
    @Id
    @Column(name = "role_id")
    private String roleid;
    @Column(name = "role_name")
    private String rolename;
    @Column(name = "role_date")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date roledate;
    @Column(name = "role_status")
    private String rolestatus;
    @ManyToMany
    @JoinTable(name="sys_role_user",
            joinColumns=
            @JoinColumn(name="role_id"),
            inverseJoinColumns=
            @JoinColumn(name="user_id")
    )
    private List<User> users;
    public String getRoleid() {
        return roleid;
    }

    public void setRoleid(String roleid) {
        this.roleid = roleid;
    }

    public String getRolename() {
        return rolename;
    }

    public void setRolename(String rolename) {
        this.rolename = rolename;
    }

    public Date getRoledate() {
        return roledate;
    }

    public void setRoledate(Date roledate) {
        this.roledate = roledate;
    }

    public String getRolestatus() {
        return rolestatus;
    }

    public void setRolestatus(String rolestatus) {
        this.rolestatus = rolestatus;
    }

    @Override
    public String toString() {
        return "Role{" +
                "roleid='" + roleid + '\'' +
                ", rolename='" + rolename + '\'' +
                ", roledate=" + roledate +
                ", rolestatus='" + rolestatus + '\'' +
                ", users=" +
                '}';
    }
}
